<?php 
/**
 * [PHPFOX_HEADER]
 * 
 * @copyright		[PHPFOX_COPYRIGHT]
 * @author  		Hai
 */
 
defined('PHPFOX') or exit('NO DICE!'); 

?>

<form method="post" onsubmit="return formUploadToSocialSubmit(this);" id="js-form-upload-to-social">
    <div class="table">
        <div class="table_left">
            Message: 
        </div>
        <div class="table_right">
            <textarea name="val[message]" style="width: 90%;"></textarea>
        </div>
        <div class="clear"></div>
    </div>
    
    <div class="table">
        <div class="table_left">
            Image: 
        </div>
        <div class="table_right">
            <div id="js-form-upload-to-social-image">
                
            </div>
            <input type="hidden" name="val[image]" />
            <input type="hidden" name="val[type]" />
        </div>
        <div class="clear"></div>
    </div>
    
    <div class="table">
        <div class="table_left">
            Choose Social: 
        </div>
        <div class="table_right">
            {module name='connectsocial.checkbox-social-active'}
        </div>
        <div class="clear"></div>
    </div>
    
    <div class="table_clear">
        <input type="submit" value="{phrase var='core.submit'}" class="button" />
        <input type="reset" value="{phrase var='core.reset'}" class="button" />	
    </div>
</form>

{literal}
<script type="text/javascript">
    
    var dataCanvas = $Core.webcam.getImage();
    var image = new Image();
    image.src = dataCanvas.image;
    
    $('#js-form-upload-to-social #js-form-upload-to-social-image').append(image);
    $('#js-form-upload-to-social').find('input[name="val[image]"]').val(dataCanvas.image);
    $('#js-form-upload-to-social').find('input[name="val[type]"]').val(dataCanvas.type);
    
    
    function formUploadToSocialSubmit(oObj) {
        $(oObj).ajaxCall('takepicture.uploadToSocial');
        $(oObj).html('Upload ...');
        return false;
    }
</script>
{/literal}